package com.ntschy.common.core.entity.enums;

import com.baomidou.mybatisplus.core.enums.IEnum;
import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonFormat;

/**
 * @author ezreal_geng
 */
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum SysRoleMenuCheckStrictlyEnum implements IEnum<Integer> {
    NO(0, "父子不互相关联显示"),
    YES(1, "父子互相关联显示");

    private final int value;

    //@JsonValue
    private final String desc;

    SysRoleMenuCheckStrictlyEnum(int value, String desc) {
        this.value = value;
        this.desc = desc;
    }

    @Override
    public Integer getValue() {
        return this.value;
    }

    public String getDesc() {
        return desc;
    }

    @JsonCreator
    public static SysRoleMenuCheckStrictlyEnum getMenuCheckStrictlyFromValue(int value) {
        for (SysRoleMenuCheckStrictlyEnum menuCheckStrictly : SysRoleMenuCheckStrictlyEnum.values()) {
            if(menuCheckStrictly.getValue() == value) {
                return menuCheckStrictly;
            }
        }
        return null;
    }
}
